<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <title>Test</title>
    <style>
        body {
            background-color: #d0e4fe;
        }

        h1 {
            font-family: "Times New Roman";
            text-align: center;
            font-size: 100px;
        }

        p {
            font-family: "Times New Roman";
            font-size: 20px;

        }

        a:link {
            color: #00FF00;
        }


        a:visited {
            color: #000000;
        }


        a:hover {
            color: #FF00FF;
        }


        a:active {
            color: #0000FF;
        }


    </style>
    <script type="text/javascript">
        function WebSocketTest() {
            if ("WebSocket" in window) {
                alert("接受对战结果数据中...");

                var ws = new WebSocket("ws://43.128.229.196/echo");


                ws.onopen = function () {

                    ws.send("");
                    alert("接受对战结果数据中...");
                };


                ws.onmessage = function (evt) {
                    var received_msg = evt.data;
                    alert("数据已接收...对战结果为：[" + received_msg + "]");
                };


                ws.onclose = function () {
                    alert("");
                };
            }

            else {

                alert("您的浏览器不支持 WebSocket!");
            }
        }
    </script>

</head>

<body>

    <div id="sse">
        <a href="javascript:WebSocketTest()">
            <h1>查询对战结果</h1>
        </a>
    </div>

</body>

</html>